/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package oldStuff;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author pjl
 */
public class MyNote implements Comparable<MyNote> {


    int chan;
    int pitch;
    int vel;
    long tick;


    public MyNote(int chan, int pitch, int vel, long tick) {
        this.chan = chan;
        this.pitch = pitch;
        this.vel = vel;
        this.tick = tick;
    }


    public int compareTo(MyNote o) {
        if (tick > o.tick) return 1;
        else if (tick < o.tick) return -1;

        if (pitch > o.pitch) return 1;
        else if (pitch < o.pitch) return -1;

        if (vel > o.vel) return 1;
        else if (vel < o.vel) return -1;
   
        if (chan > o.chan) return 1;
        else if (chan < o.chan) return -1;
        try {
            throw new Exception(" Duplicate NoteEvent");
        } catch (Exception ex) {
            Logger.getLogger(MyNote.class.getName()).log(Level.SEVERE, null, ex);
        }

        return 0;
        
    }
    
    @Override
    public String toString() {
         return tick + ">" + chan + ":" + pitch + ":" + vel;
    }
}
